#include<iostream>
#include<stack>
using namespace std;

int main()
{
	int num=0;
	char ch;
	stack<int> cmz;
	while(cin>>ch)
	{
		if(ch=='@') break;
		else if(ch>='0'&&ch<='9')
		{
			num=num*10+ch-'0';
		}
		else if(ch=='.')
		{
			cmz.push(num);
			num=0;
		}
		else//碰到操作符
		{
			int b=cmz.top();cmz.pop();
			int a=cmz.top();cmz.pop();
			if(ch=='+') cmz.push(a+b);
			if(ch=='-') cmz.push(a-b);
			if(ch=='*') cmz.push(a*b);
			if(ch=='/') cmz.push(a/b);
		}
	}
	cout<<cmz.top()<<endl;
	return 0;
}